﻿package mortal.game.net.command.skill
{
    import Framework.MQ.*;
    import Message.Public.*;
    import extend.language.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.view.skill.*;
    import mortal.mvc.core.*;

    public class SkillUpdateCommand extends BroadCastCall
    {

        public function SkillUpdateCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as SSkillUpdate;
            var _loc_3:* = Cache.instance.skill;
            switch(_loc_2.op)
            {
                case ESkillUpdateType._ESkillUpdateTypeAdd:
                {
                    _loc_3.addPlayerSkill(_loc_2.skill);
                    MsgManager.showMouseMsg(Language.getString(20057), MsgRollTipsType.msgRollTips2);
                    NetDispatcher.dispatchCmd(ServerCommand.SkillAdd, _loc_2.skill);
                    break;
                }
                case ESkillUpdateType._ESkillUpdateTypeRemove:
                {
                    _loc_3.delPlayerSkill(_loc_2.skill.skillId);
                    NetDispatcher.dispatchCmd(ServerCommand.SkillRemove, _loc_2.skill);
                    break;
                }
                case ESkillUpdateType._ESkillUpdateTypeUpdate:
                {
                    _loc_3.updatePlayerSkill(_loc_2.skill);
                    NetDispatcher.dispatchCmd(ServerCommand.SkillUpdate, _loc_2.skill);
                    break;
                }
                case ESkillUpdateType._ESkillUpdateTypeUpgrade:
                {
                    _loc_3.upgradePlayerSkill(_loc_2.skill);
                    MsgManager.showMouseMsg(Language.getString(20058), MsgRollTipsType.msgRollTips2);
                    NetDispatcher.dispatchCmd(ServerCommand.SkillUpgrade, _loc_2.skill);
                    break;
                }
                default:
                {
                    break;
                }
            }
            NetDispatcher.dispatchCmd(ServerCommand.BestSkillUpdate, null);
            return;
        }// end function

    }
}
